package com.lbd.system.bean;

import com.lbd.base.bean.AbstractEntity;
import lombok.*;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.List;

/**
 * Created by WangYajie on 2016/9/19.
 */
@Getter
@Setter
//@ToString
@AllArgsConstructor
@NoArgsConstructor
@DynamicUpdate
@Entity
@Table(name = "sys_menu")
public class Menu extends AbstractEntity {
    /**
     * 菜单名称
     */
    String name;
    /**
     * 菜单编码
     */
    String code;

    /**
     * 菜单地址
     */
    String url;
    /**
     * 菜单图标
     */
    String icon;
    /**
     * 父菜单id
     */
//    String parentId;

    @ManyToOne
    @JoinColumn(name = "parent_id")
    Menu parent;

    /*
        子节点
     */
    @OneToMany
    @JoinColumn(name = "parent_id")
    private List<Menu> children;

}
